
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        *{
            padding:0;
            margin:0;
        }
        p{
            border:1px solid green;
            background:gray;
        }
    </style>
</head>
<body>
<form action="https://www.baidu.com/s">
    <input autocomplete="off" name="wd" type="text">
</form>
<div id="root"></div>
</body>
<!--https://www.baidu.com/sugrec?prod=pc&wd=三国&cb=abc-->
<script type="module">
    import jsonp from "./js/index.js"
    document.querySelector("input").oninput = async function(){
		const {g=[]} = await jsonp({
            url:"https://www.baidu.com/sugrec",
            params:{
				prod:"pc",
                wd:this.value
            },
            jsonp:"cb"
        });
		document.querySelector("#root").innerHTML = g.map(item=>(`
		    <p>${item.q}</p>
		`)).join("");
    }
</script>
</html>